﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Boiling.BizFacade;
using Boiling.Common;

namespace Boiling.Web
{
    public partial class ModifyConfirm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string m_UserName;
            string m_PassWord;
            string m_rePassWord;
            string m_oldPassWord;
            int checkState;

            UserSystem m_user = new UserSystem();
            m_UserName = (String)Session.Contents["userID"];
            m_oldPassWord = Request.Form["oldPassWord"];
            m_PassWord = Request.Form["PassWord"];
            m_rePassWord = Request.Form["rePassWord"];
            Response.Write("网站目前处于测试阶段：</br></br>");

            Response.Write("username: " + m_UserName + "</br>");
            Response.Write("oldpassword: " + m_oldPassWord + "</br>");
            Response.Write("password: " + m_PassWord + "</br>");
            Response.Write("repassword: " + m_rePassWord + "</br>");


            // CheckState
            //emailaddress是待修改的用户邮箱
            //newpassword是修改后的密码
            //oldpassword是修改前的密码
            //返回1表示用户不存在
            //返回2表示用户存在但原密码输入错误
            //返回3表示用户存在，原密码正确，但两次新密码不一致
            //返回4表示用户密码修改成功
            checkState = m_user.ResetPassword(m_UserName, m_oldPassWord, m_PassWord, m_rePassWord);
            if (checkState == 1) Response.Write("用户不存在！</br>");
            if (checkState == 2) Response.Write("原密码输入错误 </br>");
            if (checkState == 3) Response.Write("原密码正确，但两次新密码不一致</br>");
            if (checkState == 4) Response.Write("用户密码修改成功 </br>");

            Response.Write("<a href=" + "default.aspx title=" + "Home" + ">回到首页</a>");

        }
    }
}
